package com.sky.controller.user;

import com.sky.result.Result;
import com.sky.service.admin.DishService;
import com.sky.vo.DishVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author wangqi
 * @date 2024/1/3 10:45
 */
@RestController("/userDishController")
@RequestMapping("/user/dish")
@Slf4j
public class DishController {
    @Autowired
    private DishService dishService;

    @GetMapping("/list")
    public Result<List<DishVO>> list(long categoryId) {
        log.info("根据分类id获取菜品列表：{}", categoryId);
        List<DishVO> list = dishService.getDishVOByCategoryId(categoryId);
        return Result.success(list);
    }
}
